<template>
  <div class="Calendarbox">
    <el-calendar>
      <template #date-cell="{ data }">
        <div style="display: flex;flex-direction: row;">
          <div @click="selectday(data.day);">
            {{ data.day.split("-").slice(2).join("-") }}<br />
            <lay-tooltip :content="my_date(data.day)" :is-dark="isDark">
              <span style="color:red;">{{my_date_sub(data.day)}}</span>
            </lay-tooltip>
          </div>
        </div>
      </template>
    </el-calendar>
  </div>
</template>

<script>
/**
 * 组件 - 考勤日历（动态加载数据）
 */
import { ref } from 'vue';
//别名.(方法)
export default {
  data: function () {
    return {
      res_date: [
        {"date":"2024-06-07","content":"高考"},
        {"date":"2024-06-08","content":"高考"},
        {"date":"2024-06-09","content":"试卷送往省招办"},
        {"date":"2024-06-10","content":"试卷拆分"},
        {"date":"2024-06-11","content":"阅卷"},
        {"date":"2024-06-12","content":"阅卷"},
        {"date":"2024-06-13","content":"阅卷"},
        {"date":"2024-06-14","content":"阅卷"},
        {"date":"2024-06-15","content":"阅卷"},
        {"date":"2024-06-16","content":"阅卷"},
        {"date":"2024-06-20","content":"阅卷完成"},
        {"date":"2024-06-21","content":"合分，校验"},
        {"date":"2024-06-22","content":"确认，登分"},
        {"date":"2024-06-23","content":"省招办确认分数线"},
        {"date":"2024-06-24","content":"可查分，公布一分一段表+一、二本分数线"},
        {"date":"2024-06-26","content":"提前批填报志愿"},
        {"date":"2024-06-27","content":"提前批填报志愿"},
        {"date":"2024-07-03","content":"第一批本科填报志愿"},
        {"date":"2024-07-04","content":"第一批本科填报志愿，提前批艺术、体育类录取"},
        {"date":"2024-07-05","content":"第一批本科填报志愿，提前批艺术、体育类录取"},
        {"date":"2024-07-06","content":"提前批艺术、体育类录取"},
        {"date":"2024-07-07","content":"提前批艺术、体育类录取"},
        {"date":"2024-07-08","content":"提前批艺术、体育类录取"},
        {"date":"2024-07-09","content":"提前一批本科录取，提前批艺术、体育类录取"},
        {"date":"2024-07-10","content":"提前一批本科录取，提前批艺术、体育类录取"},
        {"date":"2024-07-11","content":"专项计划一批本科含提前一批本科录取，提前批艺术、体育类录取"},
        {"date":"2024-07-12","content":"专项计划一批本科含提前一批本科录取，提前批艺术、体育类录取"},
        {"date":"2024-07-13","content":"提前批艺术、体育类录取"},
        {"date":"2024-07-14","content":"提前二批本科录取，提前批艺术、体育类录取"},
        {"date":"2024-07-15","content":"专项计划二批本科含提前二批本科录取"},
        {"date":"2024-07-16","content":"专项计划二批本科含提前二批本科录取"},
        {"date":"2024-07-17","content":"免费医学定向、公费农科生录取，一本A类录取"},
        {"date":"2024-07-18","content":"一本A类录取"},
        {"date":"2024-07-19","content":"一本A类录取"},
        {"date":"2024-07-20","content":"一本A类录取，一本A1类录取"},
        {"date":"2024-07-21","content":"一本A1类录取"},
        {"date":"2024-07-22","content":"一本B类录取,第二批本科填报志愿"},
        {"date":"2024-07-23","content":"一本B类录取,第二批本科填报志愿"},
        {"date":"2024-07-24","content":"一本B类录取,第二批本科填报志愿"},
        {"date":"2024-07-25","content":"一本B类录取"},
        {"date":"2024-07-27","content":"二本A类录取"},
        {"date":"2024-07-28","content":"二本A类录取"},
        {"date":"2024-07-29","content":"二本A类录取"},
        {"date":"2024-07-30","content":"二本A类录取"},
        {"date":"2024-08-02","content":"二本B类录取"},
        {"date":"2024-08-03","content":"二本B类录取"},
        {"date":"2024-08-04","content":"二本B类录取,二本C类、高本贯通填报志愿"},
        {"date":"2024-08-05","content":"二本C类、高本贯通填报志愿"},
        {"date":"2024-08-07","content":"二本C类录取"},
        {"date":"2024-08-08","content":"二本C类录取"},
        {"date":"2024-08-09","content":"二本C类录取"},
        {"date":"2024-08-10","content":"专科填报志愿，二本C类录取"},
        {"date":"2024-08-11","content":"专科填报志愿，二本C类录取"},
        {"date":"2024-08-12","content":"专科填报志愿"},
        {"date":"2024-08-13","content":"专科填报志愿"},
        {"date":"2024-08-14","content":"高本贯通录取"},
        {"date":"2024-08-15","content":"高本贯通录取"},
        {"date":"2024-08-16","content":"专科提前批录取"}
      ],
      timeValue: "",
    }
  },
  methods:{
    selectday(v){
      let len = this.res_date.length
      for(let i=0; i<len; i++){
        if(this.res_date[i].date == v) {
          alert(this.res_date[i].content);
          break
        }
      }
    },
    my_date(v) {
      console.log(v)
      let len = this.res_date.length
      let res = ""
      for(let i=0; i<len; i++){
        if(this.res_date[i].date == v) {
          res = this.res_date[i].content
          break
        }
      }
      return res
    },
    my_date_sub(v) {
      console.log(v)
      let len = this.res_date.length
      let res = ""
      for(let i=0; i<len; i++){
        if(this.res_date[i].date == v) {
          res = this.res_date[i].content.substr(0,3)
          break
        }
      }
      return res
    },
  }
}
</script>
